home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume6 / tetrix.pch < prev    next >
Encoding:
Text File  |  1989-07-07  |  7.9 KB  |  283 lines

  1. Path: uunet!zephyr!tektronix!tekgen!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v06i099:  tetrix - ancient Russian(?) fill the holes game [color support patch], Patch1
  5. Message-ID: <4193@tekred.CNA.TEK.COM>
  6. Date: 6 Jul 89 13:44:01 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 272
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: "Eric S. Raymond" <eric@snark.uu.net>
  12. Posting-number: Volume 6, Issue 99
  13. Archive-name: tetrix.pch1
  14. Patch-To: tetrix: Volume 6, Issue 15
  15.  
  16.     [This patch is not from the original author, yet appears to be useful
  17.      and is properly #ifdef'd, so I'm posting it here (since it was sent
  18.      to me).  Now do we need a way to differentiate between "Official"
  19.      patches and other useful patches?    -br]
  20.  
  21.     [[The SVr3.2 that came with my brand-new VGA-equipped 6386WGS includes 
  22.     color-support enhancements to the curses(3) library. I wrote the following
  23.     tetrix mods as a way to learn elementary use of the new features. The README
  24.     patch that leads the set gives details.
  25.  
  26.           Eric S. Raymond = eric@snark.uu.net]]
  27.  
  28. #! /bin/sh
  29. # This is a shell archive.  Remove anything before this line, then unpack
  30. # it by saving it into a file and typing "sh file".  To overwrite existing
  31. # files, type "sh file -c".  You can also feed this as standard input via
  32. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  33. # will see the following message at the end:
  34. #        "End of shell archive."
  35. # Contents:  patches01
  36. # Wrapped by billr@saab on Thu Jul  6 06:47:35 1989
  37. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  38. if test -f 'patches01' -a "${1}" != "-c" ; then 
  39.   echo shar: Will not clobber existing file \"'patches01'\"
  40. else
  41. echo shar: Extracting \"'patches01'\" \(5926 characters\)
  42. sed "s/^X//" >'patches01' <<'END_OF_FILE'
  43. X*** README-old    Thu Jun 29 15:15:28 1989
  44. X--- README    Thu Jun 29 15:26:11 1989
  45. X***************
  46. X*** 29,31 ****
  47. X--- 29,41 ----
  48. X  
  49. X      Good luck!                    Quentin Neill
  50. X  
  51. X+ This version has been hacked to do color under System V Release 3.2. Compile
  52. X+ with -DCOLOR to enable this feature. Due to the limited number of colors in the
  53. X+ curses(3) portable set, 'tan' pieces will be cyan-colored.
  54. X+     If you're using an EGA or VGA display, however, you can also compile
  55. X+ with -DEGA to get better colors (this uses the EGA quirk that yellow is
  56. X+ 'bright brown').
  57. X+     Finally, note that you may now invoke tetrix as    `tetrix <pause-value>'
  58. X+ to set the value of INIT_PAUSE.
  59. X+ 
  60. X+     Have fun!                    Eric S. Raymond
  61. X*** Makefile-old    Thu Jun 29 11:00:13 1989
  62. X--- Makefile    Thu Jun 29 15:12:10 1989
  63. X***************
  64. X*** 4,11 ****
  65. X  #  - this will create a high score file in /usr/tmp, so doing it again
  66. X  #    later on will erase high scores for the machine.
  67. X  
  68. X! 
  69. X! OBJS= MoveR.o MoveL.o NewP.o AdvanceP.o Rotate.o tet.o
  70. X  INCS= tet.h
  71. X  
  72. X  tetrix: $(OBJS) $(INCS)
  73. X--- 4,11 ----
  74. X  #  - this will create a high score file in /usr/tmp, so doing it again
  75. X  #    later on will erase high scores for the machine.
  76. X  
  77. X! CFLAGS=-g -DCOLOR -DEGA
  78. X! OBJS= MoveR.o MoveL.o NewP.o AdvanceP.o Rotate.o Colors.o tet.o
  79. X  INCS= tet.h
  80. X  
  81. X  tetrix: $(OBJS) $(INCS)
  82. X***************
  83. X*** 20,25 ****
  84. X--- 20,27 ----
  85. X  AdvanceP.o: AdvanceP.c
  86. X  
  87. X  Rotate.o: Rotate.c
  88. X+ 
  89. X+ Colors.o: Colors.c
  90. X  
  91. X  tet.o: tet.c
  92. X  
  93. X*** tet.h-old    Thu Jun 29 10:57:18 1989
  94. X--- tet.h    Thu Jun 29 11:12:18 1989
  95. X***************
  96. X*** 34,42 ****
  97. X--- 34,47 ----
  98. X  extern int Type, Row, Column, Pause, CurrentSpeed, FallingDown, Beep;
  99. X  extern char Board[BOARD_WIDE][BOARD_HIGH];
  100. X  
  101. X+ #ifndef COLOR
  102. X  /* Macros */
  103. X  /* offset the character on screen by MINX and MINY */
  104. X  #define PUTCH(x,y,z) {  mvaddch(y+MINY,x+MINX,z); Board[x][y]=z; }
  105. X+ #else
  106. X+ extern void PUTCH();
  107. X+ extern void init_colors();
  108. X+ #endif /* COLOR */
  109. X  
  110. X  /* test whether a square is empty and legal */
  111. X  /*
  112. X*** tet.c-old    Fri Mar  3 14:06:40 1989
  113. X--- tet.c    Thu Jun 29 14:40:50 1989
  114. X***************
  115. X*** 12,17 ****
  116. X--- 12,18 ----
  117. X  int Row;        /* Row of pivot point of block */
  118. X  int Column;        /* Column of pivot point of block */
  119. X  int Pause;        /* Time between movements this block */
  120. X+ int InitPause;        /* Initial value of CurrentPause */
  121. X  int CurrentPause;    /* Time between movements per level */
  122. X  int FallingDown;    /* True when space bar is pressed */
  123. X  int Beep;
  124. X***************
  125. X*** 58,65 ****
  126. X  #define MENU_KEY    'm'
  127. X  
  128. X  /**************************************************MAIN*****/
  129. X! main()
  130. X  {
  131. X      Init();
  132. X      for ( ; ; ) {
  133. X          NewGame();
  134. X--- 59,72 ----
  135. X  #define MENU_KEY    'm'
  136. X  
  137. X  /**************************************************MAIN*****/
  138. X! main(argc, argv)
  139. X! int argc;
  140. X! char **argv;
  141. X  {
  142. X+     if (argc >= 2)
  143. X+         InitPause = atoi(argv[1]);
  144. X+     else
  145. X+         InitPause = 150;
  146. X      Init();
  147. X      for ( ; ; ) {
  148. X          NewGame();
  149. X***************
  150. X*** 98,104 ****
  151. X      HighsChanged = 0;
  152. X      ScoreIt();
  153. X      initscr();
  154. X!     /* initilialize board to spaces */
  155. X      for (x=0; x<BOARD_WIDE; x++) 
  156. X          for (y=0; y<BOARD_HIGH; y++) 
  157. X              PUTCH(x,y,NO_CHAR);
  158. X--- 105,114 ----
  159. X      HighsChanged = 0;
  160. X      ScoreIt();
  161. X      initscr();
  162. X! #ifdef COLOR
  163. X!         init_colors();
  164. X! #endif /* COLOR */
  165. X!     /* initialize board to spaces */
  166. X      for (x=0; x<BOARD_WIDE; x++) 
  167. X          for (y=0; y<BOARD_HIGH; y++) 
  168. X              PUTCH(x,y,NO_CHAR);
  169. X***************
  170. X*** 123,129 ****
  171. X              case SCORE_KEY  : DrawScore(); break;
  172. X              case MENU_KEY    : DrawMenu(); break;
  173. X              case BOSS_KEY    : Boss(); break;
  174. X!             case PLAY_KEY    : CurrentPause=150; break;
  175. X              case QUIT_KEY   : Leave();
  176. X              }
  177. X      }
  178. X--- 133,139 ----
  179. X              case SCORE_KEY  : DrawScore(); break;
  180. X              case MENU_KEY    : DrawMenu(); break;
  181. X              case BOSS_KEY    : Boss(); break;
  182. X!             case PLAY_KEY    : CurrentPause=InitPause; break;
  183. X              case QUIT_KEY   : Leave();
  184. X              }
  185. X      }
  186. X*** Colors.c-old    Thu Jun 29 14:41:03 1989
  187. X--- Colors.c    Thu Jun 29 15:57:32 1989
  188. X***************
  189. X*** 0 ****
  190. X--- 1,83 ----
  191. X+ /* Tetrix color support by Eric S. Raymond, eric@snark.uu.net */
  192. X+ 
  193. X+ #include <curses.h>
  194. X+ #include "tet.h"
  195. X+ 
  196. X+ #ifdef COLOR
  197. X+ /* color pair indexes for pieces */
  198. X+ #define BLACK    0
  199. X+ #define GREEN    1
  200. X+ #define RED    2
  201. X+ #define TAN    3
  202. X+ #define WHITE    4
  203. X+ #define    VIOLET    5
  204. X+ #define BLUE    6
  205. X+ #define YELLOW    7
  206. X+ #define NCOLORS    8
  207. X+ 
  208. X+ static int attribs[NCOLORS];
  209. X+ 
  210. X+ typedef struct
  211. X+ {
  212. X+     int    forgrnd;
  213. X+     int attrib;
  214. X+ }
  215. X+ colorpair;
  216. X+ 
  217. X+ void init_colors()
  218. X+ {
  219. X+     start_color();
  220. X+ 
  221. X+     init_pair(BLACK, COLOR_BLACK, COLOR_BLACK);
  222. X+     attribs[BLACK] = COLOR_PAIR(BLACK);
  223. X+ 
  224. X+     init_pair(GREEN, COLOR_GREEN, COLOR_BLACK);
  225. X+     attribs[GREEN] = COLOR_PAIR(GREEN);
  226. X+ 
  227. X+     init_pair(RED, COLOR_RED, COLOR_BLACK);
  228. X+     attribs[RED] = COLOR_PAIR(RED);
  229. X+ 
  230. X+ #ifdef EGA
  231. X+     init_pair(TAN, COLOR_YELLOW, COLOR_BLACK);
  232. X+ #else
  233. X+     init_pair(TAN, COLOR_CYAN, COLOR_BLACK);
  234. X+ #endif /* EGA */
  235. X+     attribs[TAN] = COLOR_PAIR(TAN);
  236. X+ 
  237. X+     init_pair(WHITE, COLOR_WHITE, COLOR_BLACK);
  238. X+     attribs[WHITE] = COLOR_PAIR(WHITE);
  239. X+ 
  240. X+     init_pair(VIOLET, COLOR_MAGENTA, COLOR_BLACK);
  241. X+     attribs[VIOLET] = COLOR_PAIR(VIOLET);
  242. X+ 
  243. X+     init_pair(BLUE, COLOR_BLUE, COLOR_BLACK);
  244. X+     attribs[BLUE] = COLOR_PAIR(BLUE);
  245. X+ 
  246. X+ #ifdef EGA
  247. X+     attribs[YELLOW] = attribs[TAN] | A_BOLD;
  248. X+ #else
  249. X+     init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK);
  250. X+     attribs[YELLOW] = COLOR_PAIR(YELLOW);
  251. X+ #endif /* EGA */
  252. X+ }
  253. X+ 
  254. X+ void PUTCH(x,y,z)
  255. X+ int    x, y, z;
  256. X+ { 
  257. X+     switch(z)
  258. X+     {
  259. X+     case ' ': attron(attribs[BLACK]); break;
  260. X+     case 'G': attron(attribs[GREEN]); break;
  261. X+     case 'R': attron(attribs[RED]); break;
  262. X+     case 'O': attron(attribs[TAN]); break;
  263. X+     case 'W': attron(attribs[WHITE]); break;
  264. X+     case 'V': attron(attribs[VIOLET]); break;
  265. X+     case 'B': attron(attribs[BLUE]); break;
  266. X+     case 'Y': attron(attribs[YELLOW]); break;
  267. X+     }
  268. X+     mvaddch(y+MINY,x+MINX, z);
  269. X+     attrset(0);
  270. X+     Board[x][y]=z;
  271. X+ }
  272. X+ 
  273. X+ #endif /* COLOR */
  274. X
  275. END_OF_FILE
  276. if test 5926 -ne `wc -c <'patches01'`; then
  277.     echo shar: \"'patches01'\" unpacked with wrong size!
  278. fi
  279. # end of 'patches01'
  280. fi
  281. echo shar: End of shell archive.
  282. exit 0
  283.